<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>welcome</title>
    <script src="./js/jquery-3.4.1.min.js"></script>
</head>

<body>
    <h1><span id="email"></span>，欢迎登录系统！</h1>
</body>
<script>
    $(function () {
        function getQueryStringArgs(url) {
            url = url == null ? window.location.href : url;
            var qs = url.substring(url.lastIndexOf("?") + 1);
            var args = {};
            var items = qs.length > 0 ? qs.split('&') : [];
            var item = null;
            var name = null;
            var value = null;
            for (var i = 0; i < items.length; i++) {
                item = items[i].split("=");
                //用decodeURIComponent()分别解码name 和value（因为查询字符串应该是被编码过的）。
                name = decodeURIComponent(item[0]);
                value = decodeURIComponent(item[1]);

                if (name.length) {
                    args[name] = value;
                }
            }

            return args;
        }

        var email = getQueryStringArgs()['email'];
        $("document").ready(() => {
            if (email == undefined ||  email == "") {
                alert("请登录")
                window.location.href = "./login.html"
            } else {
                $("#email").text(email)
            }
        })
    })
</script>

</html>